package com.ruoyi.my.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.my.domain.Shop;
import com.ruoyi.my.mapper.shopMapper;
import com.ruoyi.my.service.IshopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商家Service业务层处理
 *
 * @author liuxusheng
 * @date 2022-01-07
 */
@Service
public class ShopServiceImpl implements IshopService {
    @Autowired
    private shopMapper shopMapper;

    /**
     * 查询商家
     *
     * @param id 商家主键
     * @return 商家
     */
    @Override
    public Shop selectshopById(Long id) {
        return shopMapper.selectshopById(id);
    }

    /**
     * 查询商家列表
     *
     * @param shop 商家
     * @return 商家
     */
    @Override
    public List<Shop> selectshopList(Shop shop) {
        return shopMapper.selectshopList(shop);
    }

    /**
     * 新增商家
     *
     * @param shop 商家
     * @return 结果
     */
    @Override
    public int insertshop(Shop shop) {
                shop.setCreateTime(DateUtils.getNowDate());
            return shopMapper.insertshop(shop);
    }

    /**
     * 修改商家
     *
     * @param shop 商家
     * @return 结果
     */
    @Override
    public int updateshop(Shop shop) {
                shop.setUpdateTime(DateUtils.getNowDate());
        return shopMapper.updateshop(shop);
    }

    /**
     * 批量删除商家
     *
     * @param ids 需要删除的商家主键
     * @return 结果
     */
    @Override
    public int deleteshopByIds(Long[] ids) {
        return shopMapper.deleteshopByIds(ids);
    }

    /**
     * 删除商家信息
     *
     * @param id 商家主键
     * @return 结果
     */
    @Override
    public int deleteshopById(Long id) {
        return shopMapper.deleteshopById(id);
    }
}
